<?php
	include('user_new.php');
	include('graph.php');
	session_start();
	mysql_connect("localhost", "pigeon", "bois");
	mysql_select_db("pigeon");
	if ($_SESSION['active'] == 1)
	{;
		$game = &$_SESSION['game'];
	}
	else
	{
		$game = new game();	
		$_SESSION['game'] = $game;
		$_SESSION['active'] = 1;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
	<title> this is the pigeon test page </title>
	<link rel="stylesheet" type="text/css" href="pige.css" />
	<script type="text/javascript" src="function.js" ></script>
</head>
<body>
	<h1>this is the pigeon developpement page</h1>
	<?
	$game->get_game();
	switch ($game->statut){
		case 0:
			//$game->ask_for_player_number();
			$grahp = new graph($game);
			$game->next_step();
			break;
		case 1:	
			$game->get_player_number();
			//$game->ask_for_player_name();
			$grahp = new graph($game);
			$game->next_step();
			break;
		case 2:			
			$game->get_players();
			$grahp = new graph($game);
			$game->start();
			break;
		case 3:	
			echo "<h2> phase 4 : tire des piges</h2>";
			$grahp = new graph($game);		
			$game->play();
			echo 	"<form METHOD='POST' action='index_new.php'>\n			
				<input type=submit value='Joueur suivant'/>\n
				</form>\n";
			break;
		case 4:
			echo "<h2> phase 5 : Jeu</h2>";
			$grahp = new graph($game);				
			$game->play();
			echo 	"<form METHOD='POST' action='index_new.php'>\n			
				<input type=submit value='Coup suivant'/>\n
				</form>\n";
			break;
		case 5:
			echo "<h2> fin du tour </h2>";
			echo 	"<form METHOD='POST' action='index_new.php'>\n	
					<input type=hidden name=game value=new />\n
					<input type=submit value='Nouvelle partie'/>\n
				</form>\n
				<br/>\n
				<form METHOD='POST' action='index_new.php'>\n
					<input type=hidden name=game value=next />\n
					<input type=submit value='Tour suivant'/>\n
				</form>\n";
			//$game->show_players_game_stat();
			$grahp = new graph($game);
			$game->end();
			break;		
	}
	mysql_close();
?>
</body>
</html>

